
function DateUtil(){}

DateUtil.timestampToDateWithoutSecond = function(timeStamp){
    const date = new Date(timeStamp); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
    // console.log("date",date);
    const Y = date.getFullYear() + "-";
    const M =
        (date.getMonth() + 1 < 10
            ? "0" + (date.getMonth() + 1)
            : date.getMonth() + 1) + "-";
    const D =
        (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
    const h =
        (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
    const m =
        date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    return Y + M + D + h + m;
}

export default DateUtil;
